#include "widget.h"
#include "ui_widget.h"
#include <QDebug>

Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    ui->setupUi(this);

    ui->listWidget->addItem("炸鸡");
    ui->listWidget->addItem("汉堡");
    ui->listWidget->addItem("薯条");
    ui->listWidget->addItem("可乐");
}

Widget::~Widget()
{
    delete ui;
}




void Widget::on_pushButton_insert_clicked()
{
    if(!ui->lineEdit->text().isEmpty())
    {
        ui->listWidget->addItem(ui->lineEdit->text());
    }
}

void Widget::on_pushButton_delete_clicked()
{
    int row = ui->listWidget->currentRow();
    qDebug() << row;
}
